﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace ShoppingWebPage.Models
{
    public class ItemsInitializer:DropCreateDatabaseIfModelChanges<ShoppingWebPageContext>
    {
        protected override void Seed(ShoppingWebPageContext context)
        {
            var items = new List<Item>
            {
                new Item{ name = "Hand Sanitizer", price = 2.00, description = "Disinfect Hands",quantity=1},
                new Item{ name = "Scissors", price = 2.00, description = "Used to cut stuff",quantity=1},
                new Item{ name = "Pen", price = 0.99,description = "Used to write permanantly",quantity=1},
                new Item{ name = "Glue", price = 1.50, description="Used to stick things together",quantity=1},
                new Item{ name = "Eraser", price = 0.50, description= "Used to remove anything written in pencil",quantity=1}
            };
            items.ForEach(i => context.Items.Add(i));
            context.SaveChanges();
        }
    }
}